#include <iostream>
using namespace std;

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(i < n - 1 && s[i] == '*' && s[i + 1] == '*'){
            break;
        }
        if(s[i] == '@') ans++;
    }
    cout << ans << endl;
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}